﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace BaseInfoManagerDal.Migrations
{
    public partial class qq : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterColumn<string>(
                name: "creator_name",
                table: "module_db",
                type: "nvarchar(50)",
                maxLength: 50,
                nullable: true,
                oldClrType: typeof(string),
                oldType: "nvarchar(50)",
                oldMaxLength: 50);

            migrationBuilder.CreateTable(
                name: "role_db",
                columns: table => new
                {
                    role_id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    role_name = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    role_status = table.Column<int>(type: "int", nullable: false),
                    creator_name = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    creator_date = table.Column<DateTime>(type: "datetime2", nullable: false),
                    modifi_name = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    modifi_date = table.Column<DateTime>(type: "datetime2", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_role_db", x => x.role_id);
                });

            migrationBuilder.CreateTable(
                name: "role_module_relation",
                columns: table => new
                {
                    id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    role_id = table.Column<int>(type: "int", nullable: false),
                    module_code = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    creator_name = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    creator_date = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_role_module_relation", x => x.id);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "role_db");

            migrationBuilder.DropTable(
                name: "role_module_relation");

            migrationBuilder.AlterColumn<string>(
                name: "creator_name",
                table: "module_db",
                type: "nvarchar(50)",
                maxLength: 50,
                nullable: false,
                defaultValue: "",
                oldClrType: typeof(string),
                oldType: "nvarchar(50)",
                oldMaxLength: 50,
                oldNullable: true);
        }
    }
}
